using UnityEngine;

public class WallUnityObject : UnityObject
{
    public override void Link(GameEntity gameEntity)
    {
        base.Link(gameEntity);
        WallComponent wall = gameEntity.wall;
        transform.position = (wall.from + wall.to) / 2.0f;
    }

    private void OnDrawGizmos()
    {
        WallComponent wall = _linkedEntity.wall;
        Vector3 from = wall.from;
        Vector3 to = wall.to;
        Vector3 center = (from + to) / 2.0f;
        Vector3 normal = wall.normal;
        Gizmos.color = Color.black;
        float height = 3;
        Vector3 offset = Vector3.up * height;
        for (int i = 0; i <= height; i++)
        {
            Vector3 h = Vector3.up * i;
            Gizmos.DrawLine(from + h, to + h);
        }

        Gizmos.DrawLine(center + offset, center + normal * 2 + offset);
        Gizmos.DrawLine(from, from + offset);
        Gizmos.DrawLine(to, to + offset);
        Gizmos.DrawLine(center, center + offset);
    }
}